{extend name="layout"}
{block name="detail"}

<section class="forms">
    <div class="container-fluid">
        <div class="row">
            <!-- Form Elements -->
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header d-flex align-items-center">
                        <h3 class="h4 mr-5">{$data['shop']['name']}</h3>
                        <a class="btn btn-warning text-white" href="{:url('admin/product/addProduct')}">添加商品</a>
                    </div>
                    <div class="card-body">
                        {if condition="$data"}
                        <div class="table-responsive">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>图片</th>
                                    <th>标题</th>
                                    <th>是否上架</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="data['product']" id="product"}
                                <tr>
                                    <th scope="row">
                                       {$key+1}
                                    </th>
                                    <td>
                                        <img src="{$product.img}" alt="" width="50" class="bdimg">
                                    </td>
                                    <td>{$product.title}</td>
                                    <td>{$product.isShow?'已经上架':'已经下架' } </td>
                                    <td>
                                        {if condition="$product.isShow eq 1"}
                                        <a href="javascript:void(0);" onclick="make_sure('确定下架商品？','{:url(\'admin/product/productShow\')}?i={$product.id}&v=0')" >下架</a>
                                        {else}
                                        <a href="javascript:void(0);" onclick="make_sure('确定上架商品？','{:url(\'admin/product/productShow\')}?i={$product.id}&v=1')">上架</a>
                                        {/if}
                                        &nbsp;|&nbsp;
                                        <a href="javascript:void(0);" onclick="make_sure('确定要删除商品？','{:url(\'admin/product/deleteProduct\')}?id={$product.id}')">删除</a>&nbsp;|&nbsp;
                                        <a href="{:url('admin/product/updateProduct',['id'=>$product.id])}">编辑或查看</a>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>

                                <tfoot>
                                <tr><td colspan="7">{$data['product']->render()}</td></tr>
                                </tfoot>
                            </table>
                        </div>
                        {else}
                        <div class="text-center" style="margin-top:200px;margin-bottom: 200px;">没有数据！</div>
                        {/if}
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

{/block}